//
//  SLable.m
//  DifferWorkIng
//
//  Created by 孙琪 on 16/7/12.
//  Copyright © 2016年 孙琪. All rights reserved.
//

#import "SLable.h"

@interface SLable ()

@end


@implementation SLable

-(instancetype)initWithFrame:(CGRect)frame Text:(NSString *)text Font:(CGFloat)font Color:(UIColor *)color textAligMent:(NSTextAlignment)textAligment{
    
    self = [super initWithFrame:frame];
    if (self) {
    
  self.text = text;
  self.font = [UIFont systemFontOfSize:GETFONTSIZE(font)];
  self.textColor = color;
  self.textAlignment = textAligment;
        
    }

    return self;
}


-(void)getLineSpaceAndFontSpaceWithText:(NSString *)text Line:(CGFloat)line FontLine:(NSNumber*)fontLine {
 
    //设置行间距
    NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:text];
    NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle1 setLineSpacing:line];
    [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [text length])];
    
    //设置字间距 NSKernAttributeName:@1.5f
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:14], NSParagraphStyleAttributeName:paragraphStyle1, NSKernAttributeName:fontLine};
    NSAttributedString *attributeStr = [[NSAttributedString alloc] initWithString:text attributes:dic];
    self.attributedText = attributeStr;

 }







@end
